<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>

<!--Author :  DebugProject _Bourdin-->
<!--Created : 27/02/07-->
<!--Modified : 05/06/07-->
<!--Script : color XML sheet for Comparison-->

<!--look for a log mark and color between the begining mark and the end mark-->
<xsl:template match="log">
<html>
	
	<head>
		<!--get the excution ID and the post list and use it as title-->
		<title> <xsl:value-of select="@execID"/> - posts = <xsl:value-of select="@pIDlist"/>
		</title>

	</head>

	<!--set the background color to white-->
	<body bgcolor="white">

		<!--for each msg mark, color the text between the begining mark and the end mark-->
		<xsl:for-each select="msg">

			
			<!-- process for empty line (without message)-->
			<xsl:choose>
  			<xsl:when test="newline">
    				<xsl:choose>
				<!--when the color attribute value is 'C', color the line background in pink and write the line number-->
				<xsl:when test="@color='C'">
					<li style="background : pink"> <xsl:value-of select="position()"/> : </li>
				</xsl:when>
		
				<!--otherwise, just write the line number-->
				<xsl:otherwise>
					<li> <xsl:value-of select="position()"/> : </li>
				</xsl:otherwise>
    				</xsl:choose>
    			</xsl:when>
  
			<!-- process for "normal" line (with a message)-->
			<xsl:otherwise>
				<xsl:choose>
       				<!--when the type attribute value is 'send'-->
				<xsl:when test="@type='send'">	
					<xsl:choose>
					<!--when the color attribute value is 'C', color the line background in pink, write the line number, write emission in blue and bold, write the sender number, the receiver number, the lost value and finally write the message content in grey-->
					<xsl:when test="@color='C'">
						<li style="background : pink">
						<xsl:value-of select="position()"/> : <FONT Color="blue"><b>  emission  </b></FONT> <b> sender = </b> <xsl:value-of select="@sender"/> <b> rcver = </b> <xsl:value-of select="@rcver"/> <b> smh = </b> <xsl:value-of select="@smh"/> <b> lost = </b> <xsl:value-of select="@lost"/>  =>  <FONT Color="grey"><xsl:value-of select="."/></FONT>
						</li>
					</xsl:when>
		
					<!--when the color attribute value is 'A-S', color the line background in yellow, write the line number, write emission in blue and bold, write the sender number, the receiver number, the lost value and finally write the message content in grey-->
					<xsl:when test="@color='A-S'">
						<li style="background : yellow">
						<xsl:value-of select="position()"/> : <FONT Color="blue"><b>  emission  </b></FONT> <b> sender = </b> <xsl:value-of select="@sender"/> <b> rcver = </b> <xsl:value-of select="@rcver"/> <b> smh = </b> <xsl:value-of select="@smh"/> <b> lost = </b> <xsl:value-of select="@lost"/>  =>  <FONT Color="grey"><xsl:value-of select="."/></FONT>
						</li>
					</xsl:when>
		
					<!--otherwise, just write the line number, the word emission in blue and bold, the sender number, the receiver number, the lost value and finally write the message content in grey-->
					<xsl:otherwise>
						<li> <xsl:value-of select="position()"/> : <FONT Color="blue"><b>  emission  </b></FONT> <b> sender = </b> <xsl:value-of select="@sender"/> <b> rcver = </b> <xsl:value-of select="@rcver"/> <b> smh = </b> <xsl:value-of select="@smh"/> <b> lost = </b> <xsl:value-of select="@lost"/>  =>  <FONT Color="grey"><xsl:value-of select="."/></FONT>
						</li>
					</xsl:otherwise>
					</xsl:choose>
  				</xsl:when>


				<!--when the type attribute value is 'rcv'-->
				<xsl:when test="@type='rcv'">	
					<xsl:choose>
					<!--when the color attribute value is 'C', color the line background in pink, write the line number, write reception in red and bold, write the sender number, the receiver number and finally write the root value-->
					<xsl:when test="@color='C'">
						<li style="background : pink">
						<xsl:value-of select="position()"/> : <FONT Color="red"><b>  reception </b> </FONT> <b> sender = </b> <xsl:value-of select="@sender"/> <b> rcver = </b> <xsl:value-of select="@rcver"/> <b> smh = </b> <xsl:value-of select="@smh"/> <b> root = </b> <xsl:value-of select="@root"/>
						</li>
					</xsl:when>
			
					<!--when the color attribute value is 'A-S', color the line background in pink, write the line number, write reception in red and bold, write the sender number, the receiver number and finally write the root value-->
					<xsl:when test="@color='A-S'">
						<li style="background : yellow">
				<xsl:value-of select="position()"/> : <FONT Color="red"><b>  reception </b> </FONT> <b> sender = </b> <xsl:value-of select="@sender"/> <b> rcver = </b> <xsl:value-of select="@rcver"/> <b> smh = </b> <xsl:value-of select="@smh"/> <b> root = </b> <xsl:value-of select="@root"/>
						</li>
					</xsl:when>
		
					<!--otherwise, just write the line number, the word reception in red and bold, the sender number, the receiver number and finally write the root value-->
					<xsl:otherwise>
						<li> <xsl:value-of select="position()"/> : <FONT Color="red"><b>  reception </b> </FONT> <b> sender = </b> <xsl:value-of select="@sender"/> <b> rcver = </b> <xsl:value-of select="@rcver"/> <b> smh = </b> <xsl:value-of select="@smh"/> <b> root = </b> <xsl:value-of select="@root"/>
						</li>
					</xsl:otherwise>
					</xsl:choose>
  
				</xsl:when>
				</xsl:choose>
   

  
			</xsl:otherwise>
			</xsl:choose>

		</xsl:for-each>

	</body>
</html>
</xsl:template>
</xsl:stylesheet>
